﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ZiyongInput.aspx.cs" Inherits="Admin.House.ZiyongInput" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>添加自用房产</title>
    <link href="/Admin/Css/rightbar.css?FileVersion=<%=FileVersion %>" rel="stylesheet"
        type="text/css" />
    <script src="/admin/Scripts/Calendar2008.js?FileVersion=<%=FileVersion %>" type="text/javascript"></script>
    <script src="/Admin/Scripts/jquery-1.4.1.min.js?FileVersion=<%=FileVersion %>" type="text/javascript"></script>
    <script src="/admin/Scripts/Check.js?FileVersion=<%=FileVersion %>" type="text/javascript"></script>
</head>
<body id="wallet">
    <div class="warp">
        <div class="topnav">
            <ul>
                <li><a href="ZiyongList.aspx"><span>自用房产管理</span></a></li>
                <li><a href="javascript:void(0);" style="cursor: default;" class="on_nav"><span>自用房产登记</span></a></li>
            </ul>
        </div>
        <div class="tab mt15">
            <ul>
                <li class="in_on"><strong>自用房产登记</strong></li>
                <li class="caution01">带 <span class="org">*</span> 号为必填项目</li>
            </ul>
        </div>
        <div class="cont" style="padding-top: 8px;" id="stb8">
            <form name="form1" method="post" action="ZiyongInput.aspx?action=add" id="form1">
            <table width="660" border="0" cellspacing="0" cellpadding="0" class="tb01">
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        <span class="org">*</span>房产证编号：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtCertificateID" name="txtCertificateID" class="input200_out"
                            style="width: 240px;" need="房产证编号必须输入" value="<%=certificateID %>" /><span class="gray pl10">请输入房产证编号</span>
                        <div id="divHouseInfo" style='padding-top: 5px; padding-left: 5px; color: Red; display: <%= (hie == null ? "none" : "")%>;'>
                            房主：<span id="spanName"><%=pName %></span>，身份证号：<span id="spanIDCardNum"><%=pIDCardNum%></span></div>
                        <input type="hidden" id="txtIDCardNum" name="txtIDCardNum" value="<%=pName %>" />
                        <input type="hidden" id="txtName" name="txtName" value="<%=pIDCardNum %>" />
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="middle" bgcolor="#F9F9F9">
                        自用日期：
                    </td>
                    <td align="left" valign="top">
                        <input type="text" id="txtStartDate" name="txtStartDate" class="input200_out" style="width: 106px;"
                            maxlength="50" date="自用开始日期格式错" />
                        -
                        <input type="text" id="txtEndDate" name="txtEndDate" class="input200_out" style="width: 106px;"
                            maxlength="50" date="自用结束日期格式错" />
                    </td>
                </tr>
            </table>
            </form>
        </div>
        <div class="btudiv">
            <ul style="width: 180px;">
                <li>
                    <input name="Submit1" type="submit" id="Submit1" class="button_sure" onclick="return CheckForm()"
                        value="确认添加" /></li>
            </ul>
        </div>
    </div>
    <script type="text/javascript">
        var c = new Calendar("c");
        c.offsetTop = 30;
        document.write(c);

        $(function () {
            //为日期输入框增加日历控件
            $(":input[date]").bind("focus", function (event) {
                c.showMoreDay = false;
                c.show(this); this.
                className = 'input60_on';
                this.onmouseout = ''
            });
        });


        //初始化
        jQuery(function ($) {
            $("#txtCertificateID").blur(function () {
                CheckCertificateID();
            });
        });
        //获取房屋信息
        function CheckCertificateID() {
            var certificateID = $("#txtCertificateID").val();
            if (certificateID == "") {
                return;
            }
            var url = "/Admin/AjaxPage/HouseInfo.aspx?action=gethouse&CertificateID=" + certificateID + "&timestamp=" + (new Date()).getTime();
            $.ajax({
                url: url,
                dataType: "json",
                success: function (data) {
                    if (data == "") {
                        $("#divHouseInfo").css("display", "none");
                        alert("房产证编号不存请先录入房产信息，再添加自用房产信息");
                        $("#Submit1").attr("disabled", true);
                    }
                    else {
                        $("#spanName").html(data[0].Name);
                        $("#txtName").val(data[0].Name);
                        $("#spanIDCardNum").html(data[0].IDCardNum);
                        $("#txtIDCardNum").val(data[0].IDCardNum);
                        $("#divHouseInfo").css("display", "");
                        $("#Submit1").attr("disabled", false);
                    }
                },
                error: function (data) {
                    //alert("验证房屋信息失败，请刷新页面重试!");
                }
            });
        }
    </script>
    <script type="text/javascript">

        function CheckForm() {
            var obj = document.form1.elements;
            if (!checkAttr(obj)) {
                return false;
            }
            $("#form1").submit();
            return true;
        }
    </script>
</body>
</html>
